{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from fastNLP.io import WeiboNERPipe"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 188k/188k [00:00<00:00, 1.80MB/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "http://212.129.155.247/dataset/weibo_NER.zip not found in cache, downloading to /tmp/tmpxwv8zuhv\n",
      "Finish download from http://212.129.155.247/dataset/weibo_NER.zip\n",
      "Copy file to /home/wenbin/.fastNLP/dataset/weibo_NER\n",
      "+-------------------------+-------------------------+-------------------------+---------+\n",
      "| raw_chars               | target                  | chars                   | seq_len |\n",
      "+-------------------------+-------------------------+-------------------------+---------+\n",
      "| ['科', '技', '全', '... | [0, 0, 0, 0, 0, 0, 0... | [792, 1015, 156, 198... | 26      |\n",
      "| ['对', '，', '输', '... | [0, 0, 0, 0, 0, 0, 3... | [123, 2, 1205, 115, ... | 15      |\n",
      "+-------------------------+-------------------------+-------------------------+---------+\n"
     ]
    }
   ],
   "source": [
    "data_bundle = WeiboNERPipe().process_from_file()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "全\n",
      "156\n"
     ]
    }
   ],
   "source": [
    "vocab1=data_bundle.get_vocab('chars')\n",
    "print(vocab1.to_word(156))\n",
    "print(vocab1.to_index('全'))\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
